<template>
  <div id="box">
    <div>
      姓名：<input type="text" v-model="name" />
        <br>
      内容：<input type="text" v-model="cont" />
    </div>

    <div>
      <button @click="send(item)">发送</button>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      name: "",
      content: "",
    };
  },
  methods: {
    send() {
      let obj = {
        name: this.name,
        content: this.cont,
      };
      axios.post("http://chst.vip:1902/students/addlist", obj).then((res) => {
        console.log(res);
        location.reload();
      });
    },
  },
};
</script>


<style scoped>
#box {
  text-align: center;
  border: 2px solid rgb(59, 85, 61);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 780px;
}
div{
    margin-left: 10px;
}
input {
  width: 100px;
  height: 20px;
  margin: 10px;
}
button{
    margin: 20px;
}
</style>